﻿// GameEvent.cs
using System;
using YooAsset;

public static class GameEvent
{
    // 补丁流程步骤改变
    public static event Action<PatchStepDefine> OnPatchStepsChange;
    public static void SendPatchStepsChange(PatchStepDefine step) => OnPatchStepsChange?.Invoke(step);

    // 发现更新文件
    public static event Action<int, long> OnFoundUpdateFiles;
    public static void SendFoundUpdateFiles(int totalCount, long totalSizeBytes) => OnFoundUpdateFiles?.Invoke(totalCount, totalSizeBytes);

    // 下载进度更新
    public static event Action<DownloadUpdateData> OnDownloadUpdate;
    public static void SendDownloadUpdate(DownloadUpdateData updateData) => OnDownloadUpdate?.Invoke(updateData);

    // 资源版本请求失败
    public static event Action OnPackageVersionRequestFailed;
    public static void SendPackageVersionRequestFailed() => OnPackageVersionRequestFailed?.Invoke();

    // 资源清单更新失败
    public static event Action OnPackageManifestUpdateFailed;
    public static void SendPackageManifestUpdateFailed() => OnPackageManifestUpdateFailed?.Invoke();

    // 网络文件下载失败
    public static event Action<DownloadErrorData> OnWebFileDownloadFailed;
    public static void SendWebFileDownloadFailed(DownloadErrorData errorData) => OnWebFileDownloadFailed?.Invoke(errorData);

    // 补丁包初始化失败
    public static event Action OnInitializeFailed;
    public static void SendInitializeFailed() => OnInitializeFailed?.Invoke();
    
    
    // 启动补丁包初始化
    public static event Action OnStartInitialize;
    public static void SendStartInitialize() => OnStartInitialize?.Invoke();

    // 更新Version
    public static event Action OnTryPackageVersion;
    public static void SendTryPackageVersion() => OnTryPackageVersion?.Invoke();
    
    // 更新Manifest
    public static event Action OnTryPackageManifest;
    public static void SendTryPackageManifest() => OnTryPackageManifest?.Invoke();
    
    // 下载
    public static event Action OnTryDownload;
    public static void SendTryDownload() => OnTryDownload?.Invoke();

    // 下载完成
    public static event Action OnDownloadOver;
    public static void SendDownloadOver() => OnDownloadOver?.Invoke();
}